import { app } from "/scripts/app.js";
import { $el } from "../../../scripts/ui.js";

const tab=$el("iframe",{
    src: "search/app?lang="+(app.ui.settings.settingsValues['Comfy.Locale']=='zh'?'zh':'en'),
    style: { width: "100%", height: "100%" },
});
const iframeEl = {
    __v_isVNode: true,
    type: "iframe",
    props: {
      src: "search/app?lang="+(app.ui.settings.settingsValues['Comfy.Locale']=='zh'?'zh':'en'),
      style: { width: "100%", height: "100%" },
    },
    key: null,
    ref: null,
    scopeId: null,
    slotScopeIds: null,
    children: null,
    component: null,
    suspense: null,
    ssContent: null,
    ssFallback: null,
    dirs: null,
    transition: null,
    el: null,
    anchor: null,
    target: null,
    targetAnchor: null,
    staticCount: 0,
    shapeFlag: 1,
    patchFlag: -1,
    dynamicProps: null,
    dynamicChildren: null,
    appContext: null,
    ctx: null,
  };
function addSidebarTab() {
    let title=app.ui.settings.settingsValues['Comfy.Locale']=='zh'?"图片搜索引擎":"Image search engine";
    app.extensionManager.registerSidebarTab({
        id: 'imageSearch',
        icon: 'pi pi-th-large',
        title: title,
        tooltip: title,
        component: iframeEl,
        type: 'vue'
      })
}

const id = "Lam.MaterialSearch";
const ext = {
    name: id,
    setup() {
        addSidebarTab();
    },
    // async beforeConfigureGraph(graphData, missingNodeTypes) {
    //     await getGroupNode(missingNodeTypes);
    // },
    // addCustomNodeDefs(defs) {
    //     // Store this so we can mutate it later with group nodes
    //     globalDefs = defs;
    // },
    // nodeCreated(node) {
        
    // },
};

app.registerExtension(ext);
